Repository navigation
journeys export-synthetics: Elastic Synthetics files for the journeys that are monitors - #42
Merged
Merged
Conversation
…urneys that are monitors The command turns each journey with @monitor into a generated *.journey.ts that embeds its text, because push bundles code and not data files. It judges @requires with the features, build type and environment it is given, keeps feature blocks for run time, skips @mutates journeys, and turns @Alert pagerduty into alert configuration only with --paging. The output depends only on the inputs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
journeys export-syntheticsto@nullean/journeys: it writes one Elastic Synthetics journey file for every journey marked@monitorthat applies to the flags, build type and environment you give it.Why
pushbundles code, not data files, so a repository that keeps its journeys as.journeyfiles has to generate the Synthetics files, and today everyone would write that generator themselves. The 0.8.0 directives (@monitor,@requires,@alert,@mutates) andfeatureblocks carry what a generator needs.What
journeys export-synthetics <file, folder or glob>... --out <folder> [--features a,b] [--build-type x] [--env name] [--paging] [--base-url url] [--root folder]. Each generated*.journey.tshas a generated-file header,journey(…),monitor.use({ id, schedule, locations, tags })from the directives, andjourneySteps(…)with the journey text embedded and the run context passed sofeatureblocks skip at run time exactly as elsewhere.@monitoris required,@requiresmust hold for the given context, and@mutatesjourneys never export. Generated monitors run withreadOnly: true. Every journey that does not export is printed with its reason.--pagingturns@alert pagerdutyintoalert: { status: { enabled: true } }plus the tagalert:pagerdutyfor a Kibana rule to route. Without it nothing alert-related is written. Schedule and locations are validated against what Synthetics accepts, so a bad value fails the export, naming the journey.pushreplaces the whole monitor set.docs/journeys/playwright.mdhas a new section, andDECISIONS.mdrecords the choices.@elastic/synthetics1.27.0 is a new dev dependency (the lockfile grows with it) so the tests can run the generated files.Verify
Golden files in
test/reference/export/cover: monitor or not,@requiresmet or not, paging on and off, feature blocks, and escaping of backticks,${and backslashes (the template literal is evaluated and compared with the source).export-live.test.tsruns generated files with the real@elastic/syntheticsCLI in Chrome against the corpus site: with the flag off the block is skipped and 4 steps pass; with the flag on the block runs and the failing step fails the run. Making paging always on, or ignoring@mutates, each fails a test.Not tested: a push to Kibana. Known limits: a skipped feature block shows as a passing step in Kibana, and
.httpfiles are skipped with a reason until the next PR.